import request from '@/utils/Request.js'

// 评论相关API
export const commentAPI = {
  // 获取评论列表
  getComments(data) {
    return request({
      method: 'POST',
      url: '/comment/getComment',
      data
    })
  },

  // 发布评论
  publishComment(data) {
    return request({
      method: 'POST',
      url: '/comment/publishComment',
      data
    })
  },

  // 点赞评论
  likeComment(data) {
    return request({
      method: 'POST',
      url: '/comment/doLike',
      data
    })
  },

  // 修改置顶类型
  changeTopType(data) {
    return request({
      method: 'POST',
      url: '/comment/changeTopType',
      data
    })
  },

  // 上传评论图片
  uploadCommentImage(formData) {
    return request({
      method: 'POST',
      url: '/comment/uploadImage',
      data: formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },

  // 删除评论图片
  deleteCommentImage(data){
    return request({
      method: 'POST',
      url: '/comment/deleteImage',
      data
    })
  },
}

export default commentAPI